﻿namespace MIC_LOGIC
{
    public delegate void StringDelegate(string msg);
    public delegate void IntegerDelegate(int value);

    /// <summary>
    /// Interface for Logic
    /// </summary>
    public interface ILogicFacade
    {
        /// <summary>
        /// Occurs when new data is parsed
        /// </summary>
        event StringDelegate OnInputDataStreamChanged;

        /// <summary>
        /// Occurs when there is checksum errors
        /// </summary>
        event IntegerDelegate OnChecksumErrorChanged;

        /// <summary>
        /// Occurs on errors
        /// </summary>
        event StringDelegate OnErrorMessage;

        /// <summary>
        /// Occurs on new info message
        /// </summary>
        event StringDelegate OnInfoMessage;

        /// <summary>
        /// Serial Port configuration
        /// </summary>
        CommStudio.Connections.SerialOptions ConnectionOptions { get; set; }

        /// <summary>
        /// Amount of time between simulated data
        /// </summary>
        double SimulationTimerTickMs { get; set; }

        /// <summary>
        /// Opens the serial port, and starts to listen for incoming data
        /// </summary>
        /// <returns>true if connection is opened</returns>
        bool StartSerialStream();

        /// <summary>
        /// Closes the serial connection
        /// </summary>
        /// <returns>true if connection is closed</returns>
        bool StopSerialStream();

        void CloseSerial();

        /// <summary>
        /// Starts data simulation
        /// </summary>
        /// <returns>true if started</returns>
        bool StartDataSimulation();

        /// <summary>
        /// Stops data simulation
        /// </summary>
        /// <returns>true if stopped</returns>
        bool StopDataSimulation();

        void LoggerSettings(
            string channel0, 
            string channel1, 
            string channel2);

        bool StartLogger(string filename);

        bool StopLogger();

        void AddValuesToLogger(string values);

        LogStreamConfiguration LogConfiguration { get; set; }
        

        

    }
}
